#include <pthread.h>
#include <iostream>


class LockGuard
{
public:
	LockGuard(pthread_mutex_t* mtx)
		:_mtx(mtx)
	{
		pthread_mutex_lock(_mtx);
		//std::cout << "LockGuard()" << std::endl;
	}

	~LockGuard()
	{
		pthread_mutex_unlock(_mtx);
		//std::cout << "~LockGuard()" << std::endl;
	}

private:
	pthread_mutex_t* _mtx;
};
